package com.quan;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;

import com.quan.common.utils.SpringContextHolder;

@EnableCaching
@EnableAsync
@SpringBootApplication
@MapperScan("com.quan.**.mapper")
public class ApplicationMars implements CommandLineRunner, DisposableBean {

	private static final Logger logger = LoggerFactory.getLogger(ApplicationMars.class);
	
	public static void main(String[] args) {
		SpringApplication.run(ApplicationMars.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		logger.info("**********************************************");
		logger.info("服务器启动.....");
		logger.info("**********************************************");
	}

	@Override
	public void destroy() throws Exception {
		logger.info("**********************************************");
		logger.info("服务器关闭.....");
		logger.info("**********************************************");
	}
	
	@Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }

	

}
